package com.new_blog.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:TQ02
 * Data:2024-01-25
 * Time:13:38
 * Text：系统配置文件
 */
@Configuration
public class MyConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginIntercept())
                .addPathPatterns("/**")    //拦截
                .excludePathPatterns("/css/*")  //放行
                .excludePathPatterns("/img/*")
                .excludePathPatterns("/js/*")
                .excludePathPatterns("/login.html")
                .excludePathPatterns("/reg.html")
                .excludePathPatterns("/blog_list.html")
                .excludePathPatterns("/userinfo/login")
                .excludePathPatterns("/userinfo/reg")
                .excludePathPatterns("/userinfo/generateImage")
                .excludePathPatterns("/api/log")
                .excludePathPatterns("/articleinfo/index");

    }
}
